home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 6
/
CU Amiga Magazine's Super CD-ROM 06 (1996)(EMAP Images)(GB)(Track 1 of 4)[!][issue 1997-01].iso
/
cucd
/
prog
/
mui
/
muibuilder
/
mb
/
m2
/
m2mui
/
mbmuiclasses.def
next >
Wrap
Text File
|
1994-11-30
|
14KB
|
392 lines
DEFINITION MODULE MuiClasses;
(*************************************************************************
** Structures and Macros for creating MUI custom classes.
**
** converted for M2 by Christian 'Kochtopf' Scholz
||
|| some changes by Stefan Schulz / 20.09.94
||
**
**************************************************************************
**
** $Id: MuiClasses.def 1.8 1994/08/16 20:24:55 Kochtopf Exp $
**
** $Log: MuiClasses.def $
# Revision 1.8 1994/08/16 20:24:55 Kochtopf
# mCustumClassPtr hinzugefügt
# mCustomClass nach M2-Standard umbenannt
#
# Revision 1.7 1994/08/16 19:41:22 Kochtopf
# added MUIKEYPOPUP
#
# Revision 1.6 1994/06/30 21:03:01 Kochtopf
# changed again SHORTINT to SHORTCARD for madAddLeft, etc.
#
# Revision 1.5 1994/06/30 20:56:40 Kochtopf
# Typ bei madAddLeft, etc. von BYTE in SHORTINT geändert, um
# besser damit rechnen zu können.
#
# Revision 1.4 1994/06/27 22:04:58 Kochtopf
# changed name from MUIClasses to MuiClasses
# added definition of mCustomClass
#
# Revision 1.3 1994/06/23 21:36:53 Kochtopf
# upgraded to MUI 2.1
# added mCustumClass-Definition
#
# Revision 1.2 1994/02/19 12:42:19 Kochtopf
# Neue Prozeduren hinzugefuegt, die in mui.h definiert waren.
# Ausserdem etwas die Reihenfolge geaendert, so dass man jetzt alles
# benutzen koennen sollte.
#
# Revision 1.1 1994/02/02 09:37:18 Kochtopf
# Initial revision
#
**
**************************************************************************)
FROM SYSTEM IMPORT ADDRESS, WORD, BYTE, LONGSET;
FROM IntuitionD IMPORT ObjectPtr, WindowPtr, ScreenPtr, DrawInfoPtr, IBox,
IntuiMessagePtr, IClassPtr;
FROM ExecD IMPORT LibraryPtr;
FROM GraphicsD IMPORT TextFontPtr, RastPortPtr;
FROM MuiD IMPORT APTR;
(*
** at the beginning some general things used for BOOPSI-Objects
*)
(* get a pointer to our instance data *)
PROCEDURE InstData(cl : IClassPtr; obj : ObjectPtr) : ADDRESS;
(* get the size ... *)
PROCEDURE InstSize(cl : IClassPtr) : CARDINAL;
(*
** now the things concerning MUI's view of the things
**
** GENERAL NOTES:
**
** - Everything described in this defintion file is only valid within
** MUI classes. You may never use any of these things out of
** a class, e.g. in a traditional MUI application.
**
** - Except when otherwise stated, all structures are strictly read only.
*)
(* Pointer-Types *)
TYPE mGlobalInfoPtr = POINTER TO mGlobalInfo;
mMinMaxPtr = POINTER TO mMinMax;
mNotifyDataPtr = POINTER TO mNotifyData;
mAreaDataPtr = POINTER TO mAreaData;
mRenderInfoPtr = POINTER TO mRenderInfo;
mConfigurationPtr = ADDRESS;
mImagePtr = ADDRESS;
mImageInfoPtr = ADDRESS;
WORDPtr = POINTER TO WORD;
mCustomClassPtr = POINTER TO mCustomClass;
(*
** Definitions for madFlags
** (you will get these flags e.g. with a Draw-Method.)
*)
TYPE MADFlags = (drawObject, (* completely redraw yourself *)
drawUpdate, (* only update! *)
p2, p3, p4, p5, p6, p7, p8, p9, p10, p11,
p12, p13, p14, p15, p16, p17, p18, p19, p20, p21,
p22, p23, p24, p25, p26, p27, p28, p29, p30, p31
(* rest is private, but must be specified to get a LONGSET *)
);
MADFlagSet = SET OF MADFlags;
(*
** Type definitions of some important Methods
** You will need them in your own classes.
*)
(* Area *)
TYPE mpAskMinMaxPtr = POINTER TO mpAskMinMax;
mpDrawPtr = POINTER TO mpDraw;
mpHandleInputPtr= POINTER TO mpHandleInput;
mpSetUpPtr = POINTER TO mpSetUp;
mpBoopsiQueryPtr= POINTER TO mpBoopsiQuery;
TYPE mpAskMinMax = RECORD
id : LONGINT;
MinMaxInfo : mMinMaxPtr;
END;
mpDraw = RECORD
id : LONGINT;
flags : MADFlagSet;
END;
mpHandleInput = RECORD
id : LONGINT;
imsg : IntuiMessagePtr;
muikey : LONGINT;
END;
mpSetUp = RECORD
id : LONGINT;
RenderInfo : mRenderInfoPtr;
END;
mpBoopsiQuery = RECORD
id : LONGCARD;
screen : ScreenPtr; (* obsolete *)
flags : LONGCARD; (* read only *)
minWidth, (* write only *)
minHeight, (* write only *)
maxWidth, (* write only *)
maxHeight, (* write only *)
defWidth, (* write only *)
defHeight : LONGCARD; (* write only *)
renderInfo : mRenderInfoPtr; (* read only *)
(* may grow in future ... *)
END;
CONST mbqfHORIZ = 1;
CONST mbqMAXMAX = 10000;
(* (partial) instance data of notify class *)
TYPE mNotifyData = RECORD
globalInfo : mGlobalInfoPtr;
userData : LONGINT;
priv0 : LONGINT;
priv1 : LONGINT;
priv2 : LONGINT;
priv3 : LONGINT;
priv4 : LONGINT;
END;
(* mMinMax structure holds information about minimum, maximum
and default dimensions of an object. *)
mMinMax = RECORD
MinWidth : CARDINAL;
MinHeight : CARDINAL;
MaxWidth : CARDINAL;
MaxHeight : CARDINAL;
DefWidth : CARDINAL;
DefHeight : CARDINAL;
END;
CONST mMAXMAX = 10000; (* use this if a dimension is not limited. *)
(* (partial) instance data of area class *)
TYPE mAreaData = RECORD
renderInfo : mRenderInfoPtr; (* RenderInfo for this object *)
background : mImagePtr; (* Background Image *)
font : TextFontPtr; (* Font *)
minMax : mMinMax; (* min/max/default sizes *)
box : IBox; (* position and dimension *)
addLeft : SHORTCARD; (* frame & innerspacing left offset *)
addTop : SHORTCARD; (* frame & innerspacing top offset *)
subWidth : SHORTCARD; (* frame & innerspacing add. width *)
subHeight : SHORTCARD; (* frame & innerspacing add. height *)
flags : MADFlagSet; (* see definitions above *)
(* ... private data follows ... *)
END;
(* Global information about configuration and parent application. *)
TYPE mGlobalInfo = RECORD
configuration : mConfigurationPtr;
applicationObject : ObjectPtr;
(* ... private data follows ... *)
END;
(* MUI's draw pens *)
CONST MPENSHINE =0;
CONST MPENHALFSHINE =1;
CONST MPENBACKGROUND =2;
CONST MPENHALFSHADOW =3;
CONST MPENSHADOW =4;
CONST MPENTEXT =5;
CONST MPENFILL =6;
CONST MPENCOUNT =7;
(* Information on display environment *)
TYPE mRenderInfo = RECORD
windowObject : ObjectPtr; (* valid between MUIMSetup/MUIMCleanup *)
screen : ScreenPtr; (* valid between MUIMSetup/MUIMCleanup *)
drawInfo : DrawInfoPtr; (* valid between MUIMSetup/MUIMCleanup *)
pens : WORDPtr; (* valid between MUIMSetup/MUIMCleanup *)
window : WindowPtr; (* valid between MUIMShow/MUIMHide *)
rastPort : RastPortPtr; (* valid between MUIMShow/MUIMHide *)
(* ... private data follows ... *)
END;
(*
** some procedures to get some information about our object
*)
PROCEDURE muiNotifyData(obj : APTR) : mNotifyDataPtr;
PROCEDURE muiAreaData(obj : APTR) : mAreaDataPtr;
PROCEDURE muiGlobalInfo(obj : APTR) : mGlobalInfoPtr;
PROCEDURE muiRenderInfo(obj : APTR) : mRenderInfoPtr;
PROCEDURE muiUserData(obj : APTR) : LONGINT;
(*
** some more specialized functions to retain information about special
** object-data like rastport, window, etc.
*)
PROCEDURE OBJ_app(obj : APTR) : ObjectPtr;
PROCEDURE OBJ_win(obj : APTR) : ObjectPtr;
PROCEDURE OBJ_dri(obj : APTR) : DrawInfoPtr;
PROCEDURE OBJ_window(obj : APTR) : WindowPtr;
PROCEDURE OBJ_screen(obj : APTR) : ScreenPtr;
PROCEDURE OBJ_rp(obj : APTR) : RastPortPtr;
PROCEDURE OBJ_left(obj : APTR) : INTEGER;
PROCEDURE OBJ_top(obj : APTR) : INTEGER;
PROCEDURE OBJ_width(obj : APTR) : INTEGER;
PROCEDURE OBJ_height(obj : APTR) : INTEGER;
PROCEDURE OBJ_right(obj : APTR) : INTEGER;
PROCEDURE OBJ_bottom(obj : APTR) : INTEGER;
PROCEDURE OBJ_addleft(obj : APTR) : INTEGER;
PROCEDURE OBJ_addtop(obj : APTR) : INTEGER;
PROCEDURE OBJ_subwidth(obj : APTR) : INTEGER;
PROCEDURE OBJ_subheight(obj : APTR) : INTEGER;
PROCEDURE OBJ_mleft(obj : APTR) : INTEGER;
PROCEDURE OBJ_mtop(obj : APTR) : INTEGER;
PROCEDURE OBJ_mwidth(obj : APTR) : INTEGER;
PROCEDURE OBJ_mheight(obj : APTR) : INTEGER;
PROCEDURE OBJ_mright(obj : APTR) : INTEGER;
PROCEDURE OBJ_mbottom(obj : APTR) : INTEGER;
PROCEDURE OBJ_font(obj : APTR) : TextFontPtr;
PROCEDURE OBJ_flags(obj : APTR) : MADFlagSet;
(* User configurable keyboard events coming with MUIMHandleInput *)
CONST MUIKEYRELEASE = -2; (* not a real key, faked when MUIKEYPRESS is released *)
CONST MUIKEYNONE = -1;
CONST MUIKEYPRESS = 0;
CONST MUIKEYTOGGLE = 1;
CONST MUIKEYUP = 2;
CONST MUIKEYDOWN = 3;
CONST MUIKEYPAGEUP = 4;
CONST MUIKEYPAGEDOWN = 5;
CONST MUIKEYTOP = 6;
CONST MUIKEYBOTTOM = 7;
CONST MUIKEYLEFT = 8;
CONST MUIKEYRIGHT = 9;
CONST MUIKEYWORDLEFT = 10;
CONST MUIKEYWORDRIGHT = 11;
CONST MUIKEYLINESTART = 12;
CONST MUIKEYLINEEND = 13;
CONST MUIKEYGADGETNEXT = 14;
CONST MUIKEYGADGETPREV = 15;
CONST MUIKEYGADGETOFF = 16;
CONST MUIKEYWINDOWCLOSE = 17;
CONST MUIKEYWINDOWNEXT = 18;
CONST MUIKEYWINDOWPREV = 19;
CONST MUIKEYHELP = 20;
CONST MUIKEYPOPUP = 21;
CONST MUIKEYCOUNT = 22; (* private *)
(*
** now something about dispatchers.
** if you have written your dispatcher make sure it has the format of
** PROCEDURE Dispatcher(cl : IClassPtr; obj : ADDRESS; msg : ADDRESS) : ADDRESS
** (like DispatcherDef)
** Then call in your main routine the procedure MakeDispatcher like this :
** MakeDispatcher(Dispatcher, MyClass),
** where MyClass is the initialized IClassPtr of your new class.
** This function will then set up your dispatcher with a little stub which
** will restore A4 for your (will mean, your programm will be pure, if you
** do all right)
*)
(* here the definition of a dispatcher! *)
TYPE DispatcherDef = PROCEDURE ( (*class*) IClassPtr,
(*object*) ADDRESS,
(*message*) ADDRESS) : ADDRESS;
(* now the procedure MakeDispatcher : *)
PROCEDURE MakeDispatcher(entry:DispatcherDef; VAR myclass : IClassPtr);
(*
** at last a little procedure to fill in the values in the MinMax-Record.
** You can call it inside an AskMinMax-Method, because it is ever the same...
*)
PROCEDURE FillMinMaxInfo (msg : mpAskMinMaxPtr; MinWidth : CARDINAL;
DefWidth : CARDINAL;
MaxWidth : CARDINAL;
MinHeight : CARDINAL;
DefHeight : CARDINAL;
MaxHeight : CARDINAL);
(*
** 2 useful procedures for testing if some coordinates are inside your object
** (converted from the ones in class3.c. So look there how to use... )
*)
(* this will test if x is between a and b *)
PROCEDURE OBJ_between(a,x,b : INTEGER) : BOOLEAN;
(* this will test, if the position (x, y) is inside the Object obj *)
PROCEDURE OBJ_isInObject(x, y : INTEGER; obj : ObjectPtr) : BOOLEAN;
(* MUI_CustomClass returned by MUI_CreateCustomClass() *)
TYPE
mCustomClass = RECORD
userData : APTR; (* use for whatever you want *)
utilityBase : LibraryPtr; (* MUI has opened these libraries *)
dosBase : LibraryPtr; (* for you automatically. You can *)
gfxBase : LibraryPtr; (* use them or decide to open *)
intuitionBase : LibraryPtr; (* your libraries yourself. *)
super : IClassPtr; (* pointer to super class *)
class : IClassPtr; (* pointer to the new class *)
(* ... private data follows ... *)
END;
END MuiClasses.